package com.xinchuang.controller;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.xinchuang.utils.CheckUtil;
import com.xinchuang.comment.R;
import com.xinchuang.comment.ResultCode;
import com.google.gson.Gson;

import java.text.SimpleDateFormat;

import com.xinchuang.utils.DateUtils;
import org.springframework.web.multipart.MultipartFile;
import org.apache.commons.lang3.StringUtils;
import com.xinchuang.service.MbManageService;

/**
 * MbManageController
 *
 * @date 2023-08-25
 */
@RestController
@RequestMapping("/mbManage")
@Api(value = "MB管理", tags = "MB管理")
public class MbManageController {
    private static SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );

    @Resource
    private MbManageService mbManageService;

    /**
     * MB列表查询接口  函数名称mbList  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/mbList")
    @ApiOperation("MB列表查询")
    public R mbList(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + mbListACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.mbList( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + mbListACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * 子MB列表查询接口  函数名称subList  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/subList")
    @ApiOperation("子MB列表查询")
    public R subList(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + subListACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.subList( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + subListACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * MB基础信息查询接口  函数名称mbInfo  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/mbInfo")
    @ApiOperation("MB基础信息查询")
    public R mbInfo(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + mbInfoACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.mbInfo( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + mbInfoACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * 子MB信息查询接口  函数名称subInfo  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/subInfo")
    @ApiOperation("子MB信息查询")
    public R subInfo(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + subInfoACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.subInfo( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + subInfoACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * MB详细信息查询接口  函数名称mbDetail  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/mbDetail")
    @ApiOperation("MB详细信息查询")
    public R mbDetail(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + mbDetailACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.mbDetail( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + mbDetailACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * 子MB详细信息查询接口  函数名称subDetail  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/subDetail")
    @ApiOperation("子MB详细信息查询")
    public R subDetail(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + subDetailACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.subDetail( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + subDetailACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * MB基本信息编辑接口  函数名称mbInfoEdit  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/mbInfoEdit")
    @ApiOperation("MB基本信息编辑")
    public R mbInfoEdit(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + mbInfoEditACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.mbInfoEdit( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + mbInfoEditACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * 子MB基本信息编辑接口  函数名称subInfoEdit  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/subInfoEdit")
    @ApiOperation("子MB基本信息编辑")
    public R subInfoEdit(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + subInfoEditACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.subInfoEdit( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + subInfoEditACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * MB详细信息编辑接口  函数名称mbDetailEdit  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/mbDetailEdit")
    @ApiOperation("MB详细信息编辑")
    public R mbDetailEdit(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + mbDetailEditACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.mbDetailEdit( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + mbDetailEditACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * 子MB详细信息编辑接口  函数名称subDetailEdit  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/subDetailEdit")
    @ApiOperation("子MB详细信息编辑")
    public R subDetailEdit(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + subDetailEditACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.subDetailEdit( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + subDetailEditACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * MB删除接口  函数名称mbDelete  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/mbDelete")
    @ApiOperation("MB删除")
    public R mbDelete(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + mbDeleteACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.mbDelete( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + mbDeleteACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }

    /**
     * 子MB删除接口  函数名称subDelete  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/subDelete")
    @ApiOperation("子MB删除")
    public R subDelete(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop( jsonObject, "", methodName + "SC", sSet );
        result = result + subDeleteACS( sSet );
        if (result.length() > 0) {
            return R.fail( "入参：" + result );
        } else {
            // 调用业务层代码
            String r = mbManageService.subDelete( jsonObject );
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject( r );
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop( o.get( "data" ), "", methodName + "AC", aSet );
            result = result + subDeleteACB( aSet );
            if (result.length() > 0) {
                return R.fail( "出参：" + result );
            }
            return JSON.parseObject( r, R.class );
        }
    }


    public static String jsonLoop(Object object, String result, String methodName, Set<String> set) {
        Object v = null;
        if (object instanceof JSONArray || object instanceof ArrayList) {
            JSONArray jsonArray = new JSONArray();
            if (object instanceof ArrayList) {
                jsonArray = JSONArray.parseArray( JSON.toJSONString( object ) );
            } else {
                jsonArray = (JSONArray) object;
            }
            for (int i = 0; i < jsonArray.size(); i++) {
                result = jsonLoop( jsonArray.get( i ), result, methodName, set );
                if (StringUtils.isNotEmpty( result )) {
                    return result;
                }
            }
        }
        if (object instanceof JSONObject) {
            JSONObject jsonObject = (JSONObject) object;
            for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
                Object o = entry.getValue();
                if (o instanceof JSONArray || o instanceof ArrayList) {
                    result += selectCheckMathod( entry.getKey(), entry.getValue(), methodName, set );
                    result = jsonLoop( o, result, methodName, set );
                    if (StringUtils.isNotEmpty( result )) {
                        return result;
                    }
                } else if (o instanceof JSONObject) {
                    result = jsonLoop( o, result, methodName, set );
                    if (StringUtils.isNotEmpty( result )) {
                        return result;
                    }
                } else {
//                   FIXME: 未知类型
                }
                v = entry.getValue();
                result += selectCheckMathod( entry.getKey(), v, methodName, set );
            }
        }
        return result;
    }

    private static String selectCheckMathod(String key, Object value, String methodName, Set<String> set) {
        String result = "";
        if ("mbListSC".equals( methodName )) {
            result = mbListSC( key, value, set );
        }
        if ("mbListAC".equals( methodName )) {
            result = mbListAC( key, value, set );
        }
        if ("subListSC".equals( methodName )) {
            result = subListSC( key, value, set );
        }
        if ("subListAC".equals( methodName )) {
            result = subListAC( key, value, set );
        }
        if ("mbInfoSC".equals( methodName )) {
            result = mbInfoSC( key, value, set );
        }
        if ("mbInfoAC".equals( methodName )) {
            result = mbInfoAC( key, value, set );
        }
        if ("subInfoSC".equals( methodName )) {
            result = subInfoSC( key, value, set );
        }
        if ("subInfoAC".equals( methodName )) {
            result = subInfoAC( key, value, set );
        }
        if ("mbDetailSC".equals( methodName )) {
            result = mbDetailSC( key, value, set );
        }
        if ("mbDetailAC".equals( methodName )) {
            result = mbDetailAC( key, value, set );
        }
        if ("subDetailSC".equals( methodName )) {
            result = subDetailSC( key, value, set );
        }
        if ("subDetailAC".equals( methodName )) {
            result = subDetailAC( key, value, set );
        }
        if ("mbInfoEditSC".equals( methodName )) {
            result = mbInfoEditSC( key, value, set );
        }
        if ("mbInfoEditAC".equals( methodName )) {
            result = mbInfoEditAC( key, value, set );
        }
        if ("subInfoEditSC".equals( methodName )) {
            result = subInfoEditSC( key, value, set );
        }
        if ("subInfoEditAC".equals( methodName )) {
            result = subInfoEditAC( key, value, set );
        }
        if ("mbDetailEditSC".equals( methodName )) {
            result = mbDetailEditSC( key, value, set );
        }
        if ("mbDetailEditAC".equals( methodName )) {
            result = mbDetailEditAC( key, value, set );
        }
        if ("subDetailEditSC".equals( methodName )) {
            result = subDetailEditSC( key, value, set );
        }
        if ("subDetailEditAC".equals( methodName )) {
            result = subDetailEditAC( key, value, set );
        }
        if ("mbDeleteSC".equals( methodName )) {
            result = mbDeleteSC( key, value, set );
        }
        if ("mbDeleteAC".equals( methodName )) {
            result = mbDeleteAC( key, value, set );
        }
        if ("subDeleteSC".equals( methodName )) {
            result = subDeleteSC( key, value, set );
        }
        if ("subDeleteAC".equals( methodName )) {
            result = subDeleteAC( key, value, set );
        }
        return result;
    }


    private static String mbListSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("pageNum".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "页码", isNull, "0", "99999" );
        }
        if ("pageSize".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "页容", isNull, "0", "99999" );
        }
        if ("keyword".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "关键字", isNull, 0, 255 );
        }
        if ("country".equals( key )) {
            // 判断参数类型: String  num
            result += CheckUtil.checkJSONArray( JSONArray.parseArray( JSON.toJSONString( value ) ), "国家列表", isNull, 1000, 2, 1, 0, 50 );

        }
        if ("classify".equals( key )) {
            // 判断参数类型: String  num
            result += CheckUtil.checkJSONArray( JSONArray.parseArray( JSON.toJSONString( value ) ), "分类列表", isNull, 1000, 2, 1, 0, 50 );

        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbListAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("pageNum".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "页码", isNull, 0, 255 );
        }
        if ("pageSize".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "页容", isNull, 0, 255 );
        }
        if ("total".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "总条数", isNull, 0, 255 );
        }
        if ("dataList".equals( key )) {
            result += CheckUtil.checkJSONArray( JSONArray.parseArray( JSON.toJSONString( value ) ), "MB列表", isNull );
        }
        if ("tarName".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "名称", isNull, 0, 255 );
        }
        if ("tarIcon".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "缩略图", isNull, 0, 255 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subListSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("targetId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subListAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("data".equals( key )) {
            result += CheckUtil.checkJSONArray( JSONArray.parseArray( JSON.toJSONString( value ) ), "承载数据", isNull );
        }
        if ("subId".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "标识", isNull, 0, 255 );
        }
        if ("subName".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "名称", isNull, 0, 255 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbInfoSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("tarId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbInfoAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("tarName".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "名称", isNull, 0, 255 );
        }
        if ("tarType".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "类型", isNull, 0, 255 );
        }
        if ("country".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "国家地区", isNull, 0, 255 );
        }
        if ("grade".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "等级", isNull, 0, 255 );
        }
        if ("plotList".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "标绘信息", isNull, 0, 255 );
        }
        if ("position".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "经纬度", isNull, 0, 255 );
        }
        if ("height".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "高程", isNull, 0, 255 );
        }
        if ("area".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "面积", isNull, 0, 255 );
        }
        if ("description".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "描述", isNull, 0, 255 );
        }
        if ("img".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "图片", isNull, 0, 999 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subInfoSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("tarId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if ("subId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "子MB标识", isNull, 0, 50 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subInfoAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("subName".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "名称", isNull, 0, 255 );
        }
        if ("subType".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "类型", isNull, 0, 255 );
        }
        if ("plotList".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "标绘信息", isNull, 0, 255 );
        }
        if ("height".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "高程", isNull, 0, 255 );
        }
        if ("area".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "面积", isNull, 0, 255 );
        }
        if ("img".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "图片", isNull, 0, 255 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbDetailSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("tarId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbDetailAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subDetailSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("tarId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if ("subId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "子MB标识", isNull, 0, 50 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subDetailAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbInfoEditSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("tarId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbInfoEditAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subInfoEditSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("tarId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if ("subId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "子MB标识", isNull, 0, 50 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subInfoEditAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbDetailEditSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("tarId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbDetailEditAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subDetailEditSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("subId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "子MB标识", isNull, 0, 50 );
        }
        if ("tarId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subDetailEditAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbDeleteSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("tarIds".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num
            result += CheckUtil.checkJSONArray( JSONArray.parseArray( JSON.toJSONString( value ) ), "MB标识", isNull, 1000, 2, 1, 0, 50 );

        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbDeleteAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subDeleteSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("tarId".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "MB标识", isNull, 0, 50 );
        }
        if ("subIds".equals( key )) {
            isNull = true;
            // 判断参数类型: String  num
            result += CheckUtil.checkJSONArray( JSONArray.parseArray( JSON.toJSONString( value ) ), "子MB标识", isNull, 1000, 2, 1, 0, 50 );

        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String subDeleteAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal( value == null ? "" : value.toString(), "状态码", isNull, "0", "100000" );
        }
        if ("msg".equals( key )) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString( value == null ? "" : value.toString(), "返回消息", isNull, 0, 255 );
        }
        if ("success".equals( key )) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add( key );
        }
        return result;
    }

    private static String mbListACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String mbListACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String subListACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "targetId" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String subListACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String mbInfoACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "tarId" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String mbInfoACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String subInfoACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "tarId" );
        list.add( "subId" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String subInfoACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String mbDetailACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "tarId" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String mbDetailACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String subDetailACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "tarId" );
        list.add( "subId" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String subDetailACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String mbInfoEditACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "tarId" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String mbInfoEditACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String subInfoEditACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "tarId" );
        list.add( "subId" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String subInfoEditACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String mbDetailEditACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "tarId" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String mbDetailEditACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String subDetailEditACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "subId" );
        list.add( "tarId" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String subDetailEditACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String mbDeleteACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "tarIds" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String mbDeleteACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    private static String subDeleteACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add( "tarId" );
        list.add( "subIds" );
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "入参" );
    }

    private static String subDeleteACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue( list, set, "出参" );
    }

    /**
     * 获取集合中的不同值
     *
     * @param list
     * @param set
     * @return
     */
    private static String getCollectionDifferentValue(List<String> list, Set<String> set, String flag) {
        String result = "";
        for (String str : list) {
            if (!set.contains( str )) {
                result += str + ",";
            }
        }
        if (StringUtils.isNotEmpty( result )) {
            result = StringUtils.strip( result, "," );
            result = "---" + flag + ":" + result + "为必填参数";
        }
        return result;
    }
}
